<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
	<title>Mathematical Functions | ElasticSearch 7.7 权威指南中文版</title>
	<meta name="keywords" content="ElasticSearch 权威指南中文版, elasticsearch 7, es7, 实时数据分析，实时数据检索" />
    <meta name="description" content="ElasticSearch 权威指南中文版, elasticsearch 7, es7, 实时数据分析，实时数据检索" />
    <!-- Give IE8 a fighting chance -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
	<link rel="stylesheet" type="text/css" href="../static/styles.css" />
	<script>
	var _link = 'sql-functions-math.html';
    </script>
</head>
<body>
<div class="main-container">
    <section id="content">
        <div class="content-wrapper">
            <section id="guide" lang="zh_cn">
                <div class="container">
                    <div class="row">
                        <div class="col-xs-12 col-sm-8 col-md-8 guide-section">
                            <div style="color:gray; word-break: break-all; font-size:12px;">原英文版地址: <a href="https://www.elastic.co/guide/en/elasticsearch/reference/7.7/sql-functions-math.html" rel="nofollow" target="_blank">https://www.elastic.co/guide/en/elasticsearch/reference/7.7/sql-functions-math.html</a>, 原文档版权归 www.elastic.co 所有<br/>本地英文版地址: <a href="../en/sql-functions-math.html" rel="nofollow" target="_blank">../en/sql-functions-math.html</a></div>
                        <!-- start body -->
                  <div class="page_header">
<strong>重要</strong>: 此版本不会发布额外的bug修复或文档更新。最新信息请参考 <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html" rel="nofollow">当前版本文档</a>。
</div>
<div id="content">
<div class="breadcrumbs">
<span class="breadcrumb-link"><a href="index.html">Elasticsearch Guide [7.7]</a></span>
»
<span class="breadcrumb-link"><a href="xpack-sql.html">SQL access</a></span>
»
<span class="breadcrumb-link"><a href="sql-functions.html">Functions and Operators</a></span>
»
<span class="breadcrumb-node">Mathematical Functions</span>
</div>
<div class="navheader">
<span class="prev">
<a href="sql-functions-search.html">« Full-Text Search Functions</a>
</span>
<span class="next">
<a href="sql-functions-string.html">String Functions »</a>
</span>
</div>
<div class="section xpack">
<div class="titlepage"><div><div>
<h2 class="title">
<a id="sql-functions-math"></a>Mathematical Functions<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/sql/functions/math.asciidoc">edit</a><a class="xpack_tag" href="https://www.elastic.co/subscriptions"></a>
</h2>
</div></div></div>
<p>All math and trigonometric functions require their input (where applicable)
to be numeric.</p>
<h3>
<a id="sql-functions-math-generic"></a>Generic<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/sql/functions/math.asciidoc">edit</a>
</h3>
<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="sql-functions-math-abs"></a><code class="literal">ABS</code><a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/sql/functions/math.asciidoc">edit</a>
</h3>
</div></div></div>
<p><strong>Synopsis:</strong></p>
<div class="pre_wrapper lang-sql">
<pre class="programlisting prettyprint lang-sql">ABS(numeric_exp) <a id="CO116-1"></a><i class="conum" data-value="1"></i></pre>
</div>
<p><span class="strong strong"><strong>Input</strong></span>:</p>
<div class="calloutlist">
<table border="0" summary="Callout list">
<tr>
<td align="left" valign="top" width="5%">
<p><a href="#CO116-1"><i class="conum" data-value="1"></i></a></p>
</td>
<td align="left" valign="top">
<p>numeric expression</p>
</td>
</tr>
</table>
</div>
<p><span class="strong strong"><strong>Output</strong></span>: numeric</p>
<p><span class="strong strong"><strong>Description</strong></span>: Returns the <a href="https://en.wikipedia.org/wiki/Absolute_value" class="ulink" target="_top">absolute value</a> of <code class="literal">numeric_exp</code>. The return type is the same as the input type.</p>
<div class="pre_wrapper lang-sql">
<pre class="programlisting prettyprint lang-sql">SELECT ABS(-123.5), ABS(55);

  ABS(-123.5)  |    ABS(55)
---------------+---------------
123.5          |55</pre>
</div>
</div>

<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="sql-functions-math-cbrt"></a><code class="literal">CBRT</code><a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/sql/functions/math.asciidoc">edit</a>
</h3>
</div></div></div>
<p><strong>Synopsis:</strong></p>
<div class="pre_wrapper lang-sql">
<pre class="programlisting prettyprint lang-sql">CBRT(numeric_exp) <a id="CO117-1"></a><i class="conum" data-value="1"></i></pre>
</div>
<p><span class="strong strong"><strong>Input</strong></span>:</p>
<div class="calloutlist">
<table border="0" summary="Callout list">
<tr>
<td align="left" valign="top" width="5%">
<p><a href="#CO117-1"><i class="conum" data-value="1"></i></a></p>
</td>
<td align="left" valign="top">
<p>numeric expression</p>
</td>
</tr>
</table>
</div>
<p><span class="strong strong"><strong>Output</strong></span>: double numeric value</p>
<p><span class="strong strong"><strong>Description</strong></span>: Returns the <a href="https://en.wikipedia.org/wiki/Cube_root" class="ulink" target="_top">cube root</a> of <code class="literal">numeric_exp</code>.</p>
<div class="pre_wrapper lang-sql">
<pre class="programlisting prettyprint lang-sql">SELECT CBRT(-125.5);

   CBRT(-125.5)
-------------------
-5.0066577974783435</pre>
</div>
</div>

<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="sql-functions-math-ceil"></a><code class="literal">CEIL/CEILING</code><a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/sql/functions/math.asciidoc">edit</a>
</h3>
</div></div></div>
<p><strong>Synopsis:</strong></p>
<div class="pre_wrapper lang-sql">
<pre class="programlisting prettyprint lang-sql">CEIL(numeric_exp) <a id="CO118-1"></a><i class="conum" data-value="1"></i></pre>
</div>
<p><span class="strong strong"><strong>Input</strong></span>:</p>
<div class="calloutlist">
<table border="0" summary="Callout list">
<tr>
<td align="left" valign="top" width="5%">
<p><a href="#CO118-1"><i class="conum" data-value="1"></i></a></p>
</td>
<td align="left" valign="top">
<p>numeric expression</p>
</td>
</tr>
</table>
</div>
<p><span class="strong strong"><strong>Output</strong></span>: integer or long numeric value</p>
<p><span class="strong strong"><strong>Description</strong></span>: Returns the smallest integer greater than or equal to <code class="literal">numeric_exp</code>.</p>
<div class="pre_wrapper lang-sql">
<pre class="programlisting prettyprint lang-sql">SELECT CEIL(125.01), CEILING(-125.99);

 CEIL(125.01)  |CEILING(-125.99)
---------------+----------------
126            |-125</pre>
</div>
</div>

<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="sql-functions-math-e"></a><code class="literal">E</code><a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/sql/functions/math.asciidoc">edit</a>
</h3>
</div></div></div>
<p><strong>Synopsis:</strong></p>
<div class="pre_wrapper lang-sql">
<pre class="programlisting prettyprint lang-sql">E()</pre>
</div>
<p><span class="strong strong"><strong>Input</strong></span>: <em>none</em></p>
<p><span class="strong strong"><strong>Output</strong></span>: <code class="literal">2.718281828459045</code></p>
<p><span class="strong strong"><strong>Description</strong></span>: Returns <a href="https://en.wikipedia.org/wiki/E_%28mathematical_constant%29" class="ulink" target="_top">Euler’s number</a>.</p>
<div class="pre_wrapper lang-sql">
<pre class="programlisting prettyprint lang-sql">SELECT E(), CEIL(E());

       E()       |   CEIL(E())
-----------------+---------------
2.718281828459045|3</pre>
</div>
</div>

<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="sql-functions-math-exp"></a><code class="literal">EXP</code><a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/sql/functions/math.asciidoc">edit</a>
</h3>
</div></div></div>
<p><strong>Synopsis:</strong></p>
<div class="pre_wrapper lang-sql">
<pre class="programlisting prettyprint lang-sql">EXP(numeric_exp) <a id="CO119-1"></a><i class="conum" data-value="1"></i></pre>
</div>
<p><span class="strong strong"><strong>Input</strong></span>:</p>
<div class="calloutlist">
<table border="0" summary="Callout list">
<tr>
<td align="left" valign="top" width="5%">
<p><a href="#CO119-1"><i class="conum" data-value="1"></i></a></p>
</td>
<td align="left" valign="top">
<p>float numeric expression</p>
</td>
</tr>
</table>
</div>
<p><span class="strong strong"><strong>Output</strong></span>: double numeric value</p>
<p><span class="strong strong"><strong>Description</strong></span>: Returns <a href="https://en.wikipedia.org/wiki/Exponential_function" class="ulink" target="_top">Euler’s number at the power</a> of <code class="literal">numeric_exp</code> e<sup>numeric_exp</sup>.</p>
<div class="pre_wrapper lang-sql">
<pre class="programlisting prettyprint lang-sql">SELECT EXP(1), E(), EXP(2), E() * E();

     EXP(1)      |       E()       |     EXP(2)     |     E() * E()
-----------------+-----------------+----------------+------------------
2.718281828459045|2.718281828459045|7.38905609893065|7.3890560989306495</pre>
</div>
</div>

<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="sql-functions-math-expm1"></a><code class="literal">EXPM1</code><a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/sql/functions/math.asciidoc">edit</a>
</h3>
</div></div></div>
<p><strong>Synopsis:</strong></p>
<div class="pre_wrapper lang-sql">
<pre class="programlisting prettyprint lang-sql">EXPM1(numeric_exp) <a id="CO120-1"></a><i class="conum" data-value="1"></i></pre>
</div>
<p><span class="strong strong"><strong>Input</strong></span>:</p>
<div class="calloutlist">
<table border="0" summary="Callout list">
<tr>
<td align="left" valign="top" width="5%">
<p><a href="#CO120-1"><i class="conum" data-value="1"></i></a></p>
</td>
<td align="left" valign="top">
<p>float numeric expression</p>
</td>
</tr>
</table>
</div>
<p><span class="strong strong"><strong>Output</strong></span>: double numeric value</p>
<p><span class="strong strong"><strong>Description</strong></span>: Returns <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#expm1-double-" class="ulink" target="_top">Euler’s number at the power</a> of <code class="literal">numeric_exp</code> minus 1 (e<sup>numeric_exp</sup> - 1).</p>
<div class="pre_wrapper lang-sql">
<pre class="programlisting prettyprint lang-sql">SELECT E(), EXP(2), EXPM1(2);

       E()       |     EXP(2)     |    EXPM1(2)
-----------------+----------------+----------------
2.718281828459045|7.38905609893065|6.38905609893065</pre>
</div>
</div>

<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="sql-functions-math-floor"></a><code class="literal">FLOOR</code><a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/sql/functions/math.asciidoc">edit</a>
</h3>
</div></div></div>
<p><strong>Synopsis:</strong></p>
<div class="pre_wrapper lang-sql">
<pre class="programlisting prettyprint lang-sql">FLOOR(numeric_exp) <a id="CO121-1"></a><i class="conum" data-value="1"></i></pre>
</div>
<p><span class="strong strong"><strong>Input</strong></span>:</p>
<div class="calloutlist">
<table border="0" summary="Callout list">
<tr>
<td align="left" valign="top" width="5%">
<p><a href="#CO121-1"><i class="conum" data-value="1"></i></a></p>
</td>
<td align="left" valign="top">
<p>numeric expression</p>
</td>
</tr>
</table>
</div>
<p><span class="strong strong"><strong>Output</strong></span>: integer or long numeric value</p>
<p><span class="strong strong"><strong>Description</strong></span>: Returns the largest integer less than or equal to <code class="literal">numeric_exp</code>.</p>
<div class="pre_wrapper lang-sql">
<pre class="programlisting prettyprint lang-sql">SELECT FLOOR(125.01), FLOOR(-125.99);

 FLOOR(125.01) |FLOOR(-125.99)
---------------+---------------
125            |-126</pre>
</div>
</div>

<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="sql-functions-math-log"></a><code class="literal">LOG</code><a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/sql/functions/math.asciidoc">edit</a>
</h3>
</div></div></div>
<p><strong>Synopsis:</strong></p>
<div class="pre_wrapper lang-sql">
<pre class="programlisting prettyprint lang-sql">LOG(numeric_exp) <a id="CO122-1"></a><i class="conum" data-value="1"></i></pre>
</div>
<p><span class="strong strong"><strong>Input</strong></span>:</p>
<div class="calloutlist">
<table border="0" summary="Callout list">
<tr>
<td align="left" valign="top" width="5%">
<p><a href="#CO122-1"><i class="conum" data-value="1"></i></a></p>
</td>
<td align="left" valign="top">
<p>numeric expression</p>
</td>
</tr>
</table>
</div>
<p><span class="strong strong"><strong>Output</strong></span>: double numeric value</p>
<p><span class="strong strong"><strong>Description</strong></span>: Returns the <a href="https://en.wikipedia.org/wiki/Natural_logarithm" class="ulink" target="_top">natural logarithm</a> of <code class="literal">numeric_exp</code>.</p>
<div class="pre_wrapper lang-sql">
<pre class="programlisting prettyprint lang-sql">SELECT EXP(3), LOG(20.085536923187668);

      EXP(3)      |LOG(20.085536923187668)
------------------+-----------------------
20.085536923187668|3.0</pre>
</div>
</div>

<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="sql-functions-math-log10"></a><code class="literal">LOG10</code><a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/sql/functions/math.asciidoc">edit</a>
</h3>
</div></div></div>
<p><strong>Synopsis:</strong></p>
<div class="pre_wrapper lang-sql">
<pre class="programlisting prettyprint lang-sql">LOG10(numeric_exp) <a id="CO123-1"></a><i class="conum" data-value="1"></i></pre>
</div>
<p><span class="strong strong"><strong>Input</strong></span>:</p>
<div class="calloutlist">
<table border="0" summary="Callout list">
<tr>
<td align="left" valign="top" width="5%">
<p><a href="#CO123-1"><i class="conum" data-value="1"></i></a></p>
</td>
<td align="left" valign="top">
<p>numeric expression</p>
</td>
</tr>
</table>
</div>
<p><span class="strong strong"><strong>Output</strong></span>: double numeric value</p>
<p><span class="strong strong"><strong>Description</strong></span>: Returns the <a href="https://en.wikipedia.org/wiki/Common_logarithm" class="ulink" target="_top">base 10 logarithm</a> of <code class="literal">numeric_exp</code>.</p>
<div class="pre_wrapper lang-sql">
<pre class="programlisting prettyprint lang-sql">SELECT LOG10(5), LOG(5)/LOG(10);

     LOG10(5)     |    LOG(5)/LOG(10)
------------------+-----------------------
0.6989700043360189|0.6989700043360187</pre>
</div>
</div>

<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="sql-functions-math-pi"></a><code class="literal">PI</code><a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/sql/functions/math.asciidoc">edit</a>
</h3>
</div></div></div>
<p><strong>Synopsis:</strong></p>
<div class="pre_wrapper lang-sql">
<pre class="programlisting prettyprint lang-sql">PI()</pre>
</div>
<p><span class="strong strong"><strong>Input</strong></span>: <em>none</em></p>
<p><span class="strong strong"><strong>Output</strong></span>: <code class="literal">3.141592653589793</code></p>
<p><span class="strong strong"><strong>Description</strong></span>: Returns <a href="https://en.wikipedia.org/wiki/Pi" class="ulink" target="_top">PI number</a>.</p>
<div class="pre_wrapper lang-sql">
<pre class="programlisting prettyprint lang-sql">SELECT PI();

      PI()
-----------------
3.141592653589793</pre>
</div>
</div>

<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="sql-functions-math-power"></a><code class="literal">POWER</code><a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/sql/functions/math.asciidoc">edit</a>
</h3>
</div></div></div>
<p><strong>Synopsis:</strong></p>
<div class="pre_wrapper lang-sql">
<pre class="programlisting prettyprint lang-sql">POWER(
    numeric_exp, <a id="CO124-1"></a><i class="conum" data-value="1"></i>
    integer_exp) <a id="CO124-2"></a><i class="conum" data-value="2"></i></pre>
</div>
<p><span class="strong strong"><strong>Input</strong></span>:</p>
<div class="calloutlist">
<table border="0" summary="Callout list">
<tr>
<td align="left" valign="top" width="5%">
<p><a href="#CO124-1"><i class="conum" data-value="1"></i></a></p>
</td>
<td align="left" valign="top">
<p>numeric expression</p>
</td>
</tr>
<tr>
<td align="left" valign="top" width="5%">
<p><a href="#CO124-2"><i class="conum" data-value="2"></i></a></p>
</td>
<td align="left" valign="top">
<p>integer expression</p>
</td>
</tr>
</table>
</div>
<p><span class="strong strong"><strong>Output</strong></span>: double numeric value</p>
<p><span class="strong strong"><strong>Description</strong></span>: Returns the value of <code class="literal">numeric_exp</code> to the power of <code class="literal">integer_exp</code>.</p>
<div class="pre_wrapper lang-sql">
<pre class="programlisting prettyprint lang-sql">SELECT POWER(3, 2), POWER(3, 3);

  POWER(3, 2)  |  POWER(3, 3)
---------------+---------------
9.0            |27.0</pre>
</div>
<div class="pre_wrapper lang-sql">
<pre class="programlisting prettyprint lang-sql">SELECT POWER(5, -1), POWER(5, -2);

  POWER(5, -1) |  POWER(5, -2)
---------------+---------------
0.2            |0.04</pre>
</div>
</div>

<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="sql-functions-math-random"></a><code class="literal">RANDOM/RAND</code><a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/sql/functions/math.asciidoc">edit</a>
</h3>
</div></div></div>
<p><strong>Synopsis:</strong></p>
<div class="pre_wrapper lang-sql">
<pre class="programlisting prettyprint lang-sql">RANDOM(seed) <a id="CO125-1"></a><i class="conum" data-value="1"></i></pre>
</div>
<p><span class="strong strong"><strong>Input</strong></span>:</p>
<div class="calloutlist">
<table border="0" summary="Callout list">
<tr>
<td align="left" valign="top" width="5%">
<p><a href="#CO125-1"><i class="conum" data-value="1"></i></a></p>
</td>
<td align="left" valign="top">
<p>numeric expression</p>
</td>
</tr>
</table>
</div>
<p><span class="strong strong"><strong>Output</strong></span>: double numeric value</p>
<p><span class="strong strong"><strong>Description</strong></span>: Returns a random double using the given seed.</p>
<div class="pre_wrapper lang-sql">
<pre class="programlisting prettyprint lang-sql">SELECT RANDOM(123);

   RANDOM(123)
------------------
0.7231742029971469</pre>
</div>
</div>

<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="sql-functions-math-round"></a><code class="literal">ROUND</code><a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/sql/functions/math.asciidoc">edit</a>
</h3>
</div></div></div>
<p><strong>Synopsis:</strong></p>
<div class="pre_wrapper lang-sql">
<pre class="programlisting prettyprint lang-sql">ROUND(
    numeric_exp      <a id="CO126-1"></a><i class="conum" data-value="1"></i>
    [, integer_exp]) <a id="CO126-2"></a><i class="conum" data-value="2"></i></pre>
</div>
<p><span class="strong strong"><strong>Input</strong></span>:</p>
<div class="calloutlist">
<table border="0" summary="Callout list">
<tr>
<td align="left" valign="top" width="5%">
<p><a href="#CO126-1"><i class="conum" data-value="1"></i></a></p>
</td>
<td align="left" valign="top">
<p>numeric expression</p>
</td>
</tr>
<tr>
<td align="left" valign="top" width="5%">
<p><a href="#CO126-2"><i class="conum" data-value="2"></i></a></p>
</td>
<td align="left" valign="top">
<p>integer expression; optional</p>
</td>
</tr>
</table>
</div>
<p><span class="strong strong"><strong>Output</strong></span>: numeric</p>
<p><span class="strong strong"><strong>Description</strong></span>: Returns <code class="literal">numeric_exp</code> rounded to <code class="literal">integer_exp</code> places right of the decimal point. If <code class="literal">integer_exp</code> is negative,
<code class="literal">numeric_exp</code> is rounded to |<code class="literal">integer_exp</code>| places to the left of the decimal point. If <code class="literal">integer_exp</code> is omitted,
the function will perform as if <code class="literal">integer_exp</code> would be 0. The returned numeric data type is the same as the data type
of <code class="literal">numeric_exp</code>.</p>
<div class="pre_wrapper lang-sql">
<pre class="programlisting prettyprint lang-sql">SELECT ROUND(-345.153, 1) AS rounded;

    rounded
---------------
-345.2</pre>
</div>
<div class="pre_wrapper lang-sql">
<pre class="programlisting prettyprint lang-sql">SELECT ROUND(-345.153, -1) AS rounded;

    rounded
---------------
-350.0</pre>
</div>
</div>

<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="sql-functions-math-sign"></a><code class="literal">SIGN/SIGNUM</code><a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/sql/functions/math.asciidoc">edit</a>
</h3>
</div></div></div>
<p><strong>Synopsis:</strong></p>
<div class="pre_wrapper lang-sql">
<pre class="programlisting prettyprint lang-sql">SIGN(numeric_exp) <a id="CO127-1"></a><i class="conum" data-value="1"></i></pre>
</div>
<p><span class="strong strong"><strong>Input</strong></span>:</p>
<div class="calloutlist">
<table border="0" summary="Callout list">
<tr>
<td align="left" valign="top" width="5%">
<p><a href="#CO127-1"><i class="conum" data-value="1"></i></a></p>
</td>
<td align="left" valign="top">
<p>numeric expression</p>
</td>
</tr>
</table>
</div>
<p><span class="strong strong"><strong>Output</strong></span>: [-1, 0, 1]</p>
<p><span class="strong strong"><strong>Description</strong></span>: Returns an indicator of the sign of <code class="literal">numeric_exp</code>. If <code class="literal">numeric_exp</code> is less than zero, –1 is returned. If <code class="literal">numeric_exp</code> equals zero, 0 is returned. If <code class="literal">numeric_exp</code> is greater than zero, 1 is returned.</p>
<div class="pre_wrapper lang-sql">
<pre class="programlisting prettyprint lang-sql">SELECT SIGN(-123), SIGN(0), SIGN(415);

  SIGN(-123)   |    SIGN(0)    |   SIGN(415)
---------------+---------------+---------------
-1             |0              |1</pre>
</div>
</div>

<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="sql-functions-math-sqrt"></a><code class="literal">SQRT</code><a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/sql/functions/math.asciidoc">edit</a>
</h3>
</div></div></div>
<p><strong>Synopsis:</strong></p>
<div class="pre_wrapper lang-sql">
<pre class="programlisting prettyprint lang-sql">SQRT(numeric_exp) <a id="CO128-1"></a><i class="conum" data-value="1"></i></pre>
</div>
<p><span class="strong strong"><strong>Input</strong></span>:</p>
<div class="calloutlist">
<table border="0" summary="Callout list">
<tr>
<td align="left" valign="top" width="5%">
<p><a href="#CO128-1"><i class="conum" data-value="1"></i></a></p>
</td>
<td align="left" valign="top">
<p>numeric expression</p>
</td>
</tr>
</table>
</div>
<p><span class="strong strong"><strong>Output</strong></span>: double numeric value</p>
<p><span class="strong strong"><strong>Description</strong></span>: Returns <a href="https://en.wikipedia.org/wiki/Square_root" class="ulink" target="_top">square root</a> of <code class="literal">numeric_exp</code>.</p>
<div class="pre_wrapper lang-sql">
<pre class="programlisting prettyprint lang-sql">SELECT SQRT(EXP(2)), E(), SQRT(25);

  SQRT(EXP(2))   |       E()       |   SQRT(25)
-----------------+-----------------+---------------
2.718281828459045|2.718281828459045|5.0</pre>
</div>
</div>

<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="sql-functions-math-truncate"></a><code class="literal">TRUNCATE/TRUNC</code><a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/sql/functions/math.asciidoc">edit</a>
</h3>
</div></div></div>
<p><strong>Synopsis:</strong></p>
<div class="pre_wrapper lang-sql">
<pre class="programlisting prettyprint lang-sql">TRUNCATE(
    numeric_exp      <a id="CO129-1"></a><i class="conum" data-value="1"></i>
    [, integer_exp]) <a id="CO129-2"></a><i class="conum" data-value="2"></i></pre>
</div>
<p><span class="strong strong"><strong>Input</strong></span>:</p>
<div class="calloutlist">
<table border="0" summary="Callout list">
<tr>
<td align="left" valign="top" width="5%">
<p><a href="#CO129-1"><i class="conum" data-value="1"></i></a></p>
</td>
<td align="left" valign="top">
<p>numeric expression</p>
</td>
</tr>
<tr>
<td align="left" valign="top" width="5%">
<p><a href="#CO129-2"><i class="conum" data-value="2"></i></a></p>
</td>
<td align="left" valign="top">
<p>integer expression; optional</p>
</td>
</tr>
</table>
</div>
<p><span class="strong strong"><strong>Output</strong></span>: numeric</p>
<p><span class="strong strong"><strong>Description</strong></span>: Returns <code class="literal">numeric_exp</code> truncated to <code class="literal">integer_exp</code> places right of the decimal point. If <code class="literal">integer_exp</code> is negative,
<code class="literal">numeric_exp</code> is truncated to |<code class="literal">integer_exp</code>| places to the left of the decimal point.  If <code class="literal">integer_exp</code> is omitted,
the function will perform as if <code class="literal">integer_exp</code> would be 0. The returned numeric data type is the same as the data type
of <code class="literal">numeric_exp</code>.</p>
<div class="pre_wrapper lang-sql">
<pre class="programlisting prettyprint lang-sql">SELECT TRUNC(-345.153, 1) AS trimmed;

    trimmed
---------------
-345.1</pre>
</div>
<div class="pre_wrapper lang-sql">
<pre class="programlisting prettyprint lang-sql">SELECT TRUNCATE(-345.153, -1) AS trimmed;

    trimmed
---------------
-340.0</pre>
</div>
<h3>
<a id="sql-functions-math-trigonometric"></a>Trigonometric<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/sql/functions/math.asciidoc">edit</a>
</h3>
</div>

<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="sql-functions-math-acos"></a><code class="literal">ACOS</code><a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/sql/functions/math.asciidoc">edit</a>
</h3>
</div></div></div>
<p><strong>Synopsis:</strong></p>
<div class="pre_wrapper lang-sql">
<pre class="programlisting prettyprint lang-sql">ACOS(numeric_exp) <a id="CO130-1"></a><i class="conum" data-value="1"></i></pre>
</div>
<p><span class="strong strong"><strong>Input</strong></span>:</p>
<div class="calloutlist">
<table border="0" summary="Callout list">
<tr>
<td align="left" valign="top" width="5%">
<p><a href="#CO130-1"><i class="conum" data-value="1"></i></a></p>
</td>
<td align="left" valign="top">
<p>numeric expression</p>
</td>
</tr>
</table>
</div>
<p><span class="strong strong"><strong>Output</strong></span>: double numeric value</p>
<p><span class="strong strong"><strong>Description</strong></span>: Returns the <a href="https://en.wikipedia.org/wiki/Inverse_trigonometric_functions" class="ulink" target="_top">arccosine</a> of <code class="literal">numeric_exp</code> as an angle, expressed in radians.</p>
<div class="pre_wrapper lang-sql">
<pre class="programlisting prettyprint lang-sql">SELECT ACOS(COS(PI())), PI();

 ACOS(COS(PI())) |      PI()
-----------------+-----------------
3.141592653589793|3.141592653589793</pre>
</div>
</div>

<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="sql-functions-math-asin"></a><code class="literal">ASIN</code><a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/sql/functions/math.asciidoc">edit</a>
</h3>
</div></div></div>
<p><strong>Synopsis:</strong></p>
<div class="pre_wrapper lang-sql">
<pre class="programlisting prettyprint lang-sql">ASIN(numeric_exp) <a id="CO131-1"></a><i class="conum" data-value="1"></i></pre>
</div>
<p><span class="strong strong"><strong>Input</strong></span>:</p>
<div class="calloutlist">
<table border="0" summary="Callout list">
<tr>
<td align="left" valign="top" width="5%">
<p><a href="#CO131-1"><i class="conum" data-value="1"></i></a></p>
</td>
<td align="left" valign="top">
<p>numeric expression</p>
</td>
</tr>
</table>
</div>
<p><span class="strong strong"><strong>Output</strong></span>: double numeric value</p>
<p><span class="strong strong"><strong>Description</strong></span>: Returns the <a href="https://en.wikipedia.org/wiki/Inverse_trigonometric_functions" class="ulink" target="_top">arcsine</a> of <code class="literal">numeric_exp</code> as an angle, expressed in radians.</p>
<div class="pre_wrapper lang-sql">
<pre class="programlisting prettyprint lang-sql">SELECT ROUND(DEGREES(ASIN(0.7071067811865475))) AS "ASIN(0.707)", ROUND(SIN(RADIANS(45)), 3) AS "SIN(45)";

  ASIN(0.707)  |    SIN(45)
---------------+---------------
45.0           |0.707</pre>
</div>
</div>

<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="sql-functions-math-atan"></a><code class="literal">ATAN</code><a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/sql/functions/math.asciidoc">edit</a>
</h3>
</div></div></div>
<p><strong>Synopsis:</strong></p>
<div class="pre_wrapper lang-sql">
<pre class="programlisting prettyprint lang-sql">ATAN(numeric_exp) <a id="CO132-1"></a><i class="conum" data-value="1"></i></pre>
</div>
<p><span class="strong strong"><strong>Input</strong></span>:</p>
<div class="calloutlist">
<table border="0" summary="Callout list">
<tr>
<td align="left" valign="top" width="5%">
<p><a href="#CO132-1"><i class="conum" data-value="1"></i></a></p>
</td>
<td align="left" valign="top">
<p>numeric expression</p>
</td>
</tr>
</table>
</div>
<p><span class="strong strong"><strong>Output</strong></span>: double numeric value</p>
<p><span class="strong strong"><strong>Description</strong></span>: Returns the <a href="https://en.wikipedia.org/wiki/Inverse_trigonometric_functions" class="ulink" target="_top">arctangent</a> of <code class="literal">numeric_exp</code> as an angle, expressed in radians.</p>
<div class="pre_wrapper lang-sql">
<pre class="programlisting prettyprint lang-sql">SELECT DEGREES(ATAN(TAN(RADIANS(90))));

DEGREES(ATAN(TAN(RADIANS(90))))
-------------------------------
90.0</pre>
</div>
</div>

<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="sql-functions-math-atan2"></a><code class="literal">ATAN2</code><a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/sql/functions/math.asciidoc">edit</a>
</h3>
</div></div></div>
<p><strong>Synopsis:</strong></p>
<div class="pre_wrapper lang-sql">
<pre class="programlisting prettyprint lang-sql">ATAN2(
    ordinate, <a id="CO133-1"></a><i class="conum" data-value="1"></i>
    abscisa)  <a id="CO133-2"></a><i class="conum" data-value="2"></i></pre>
</div>
<p><span class="strong strong"><strong>Input</strong></span>:</p>
<div class="calloutlist">
<table border="0" summary="Callout list">
<tr>
<td align="left" valign="top" width="5%">
<p><a href="#CO133-1"><i class="conum" data-value="1"></i></a></p>
</td>
<td align="left" valign="top">
<p>numeric expression</p>
</td>
</tr>
<tr>
<td align="left" valign="top" width="5%">
<p><a href="#CO133-2"><i class="conum" data-value="2"></i></a></p>
</td>
<td align="left" valign="top">
<p>numeric expression</p>
</td>
</tr>
</table>
</div>
<p><span class="strong strong"><strong>Output</strong></span>: double numeric value</p>
<p><span class="strong strong"><strong>Description</strong></span>: Returns the <a href="https://en.wikipedia.org/wiki/Atan2" class="ulink" target="_top">arctangent of the <code class="literal">ordinate</code> and <code class="literal">abscisa</code> coordinates</a> specified as an angle, expressed in radians.</p>
<div class="pre_wrapper lang-sql">
<pre class="programlisting prettyprint lang-sql">SELECT ATAN2(5 * SIN(RADIANS(45)), 5 * COS(RADIANS(45))) AS "ATAN2(5*SIN(45), 5*COS(45))", RADIANS(45);

ATAN2(5*SIN(45), 5*COS(45))|   RADIANS(45)
---------------------------+------------------
0.7853981633974483         |0.7853981633974483</pre>
</div>
</div>

<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="sql-functions-math-cos"></a><code class="literal">COS</code><a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/sql/functions/math.asciidoc">edit</a>
</h3>
</div></div></div>
<p><strong>Synopsis:</strong></p>
<div class="pre_wrapper lang-sql">
<pre class="programlisting prettyprint lang-sql">COS(numeric_exp) <a id="CO134-1"></a><i class="conum" data-value="1"></i></pre>
</div>
<p><span class="strong strong"><strong>Input</strong></span>:</p>
<div class="calloutlist">
<table border="0" summary="Callout list">
<tr>
<td align="left" valign="top" width="5%">
<p><a href="#CO134-1"><i class="conum" data-value="1"></i></a></p>
</td>
<td align="left" valign="top">
<p>numeric expression</p>
</td>
</tr>
</table>
</div>
<p><span class="strong strong"><strong>Output</strong></span>: double numeric value</p>
<p><span class="strong strong"><strong>Description</strong></span>: Returns the <a href="https://en.wikipedia.org/wiki/Trigonometric_functions#cosine" class="ulink" target="_top">cosine</a> of <code class="literal">numeric_exp</code>, where <code class="literal">numeric_exp</code> is an angle expressed in radians.</p>
<div class="pre_wrapper lang-sql">
<pre class="programlisting prettyprint lang-sql">SELECT COS(RADIANS(180)), POWER(SIN(RADIANS(54)), 2) + POWER(COS(RADIANS(54)), 2) AS pythagorean_identity;

COS(RADIANS(180))|pythagorean_identity
-----------------+--------------------
-1.0             |1.0</pre>
</div>
</div>

<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="sql-functions-math-cosh"></a><code class="literal">COSH</code><a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/sql/functions/math.asciidoc">edit</a>
</h3>
</div></div></div>
<p><strong>Synopsis:</strong></p>
<div class="pre_wrapper lang-sql">
<pre class="programlisting prettyprint lang-sql">COSH(numeric_exp) <a id="CO135-1"></a><i class="conum" data-value="1"></i></pre>
</div>
<p><span class="strong strong"><strong>Input</strong></span>:</p>
<div class="calloutlist">
<table border="0" summary="Callout list">
<tr>
<td align="left" valign="top" width="5%">
<p><a href="#CO135-1"><i class="conum" data-value="1"></i></a></p>
</td>
<td align="left" valign="top">
<p>numeric expression</p>
</td>
</tr>
</table>
</div>
<p><span class="strong strong"><strong>Output</strong></span>: double numeric value</p>
<p><span class="strong strong"><strong>Description</strong></span>: Returns the <a href="https://en.wikipedia.org/wiki/Hyperbolic_function" class="ulink" target="_top">hyperbolic cosine</a> of <code class="literal">numeric_exp</code>.</p>
<div class="pre_wrapper lang-sql">
<pre class="programlisting prettyprint lang-sql">SELECT COSH(5), (POWER(E(), 5) + POWER(E(), -5)) / 2 AS "(e^5 + e^-5)/2";

     COSH(5)     | (e^5 + e^-5)/2
-----------------+-----------------
74.20994852478785|74.20994852478783</pre>
</div>
</div>

<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="sql-functions-math-cot"></a><code class="literal">COT</code><a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/sql/functions/math.asciidoc">edit</a>
</h3>
</div></div></div>
<p><strong>Synopsis:</strong></p>
<div class="pre_wrapper lang-sql">
<pre class="programlisting prettyprint lang-sql">COT(numeric_exp) <a id="CO136-1"></a><i class="conum" data-value="1"></i></pre>
</div>
<p><span class="strong strong"><strong>Input</strong></span>:</p>
<div class="calloutlist">
<table border="0" summary="Callout list">
<tr>
<td align="left" valign="top" width="5%">
<p><a href="#CO136-1"><i class="conum" data-value="1"></i></a></p>
</td>
<td align="left" valign="top">
<p>numeric expression</p>
</td>
</tr>
</table>
</div>
<p><span class="strong strong"><strong>Output</strong></span>: double numeric value</p>
<p><span class="strong strong"><strong>Description</strong></span>: Returns the <a href="https://en.wikipedia.org/wiki/Trigonometric_functions#Cosecant,_secant,_and_cotangent" class="ulink" target="_top">cotangent</a> of <code class="literal">numeric_exp</code>, where <code class="literal">numeric_exp</code> is an angle expressed in radians.</p>
<div class="pre_wrapper lang-sql">
<pre class="programlisting prettyprint lang-sql">SELECT COT(RADIANS(30)) AS "COT(30)", COS(RADIANS(30)) / SIN(RADIANS(30)) AS "COS(30)/SIN(30)";

     COT(30)      | COS(30)/SIN(30)
------------------+------------------
1.7320508075688774|1.7320508075688776</pre>
</div>
</div>

<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="sql-functions-math-degrees"></a><code class="literal">DEGREES</code><a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/sql/functions/math.asciidoc">edit</a>
</h3>
</div></div></div>
<p><strong>Synopsis:</strong></p>
<div class="pre_wrapper lang-sql">
<pre class="programlisting prettyprint lang-sql">DEGREES(numeric_exp) <a id="CO137-1"></a><i class="conum" data-value="1"></i></pre>
</div>
<p><span class="strong strong"><strong>Input</strong></span>:</p>
<div class="calloutlist">
<table border="0" summary="Callout list">
<tr>
<td align="left" valign="top" width="5%">
<p><a href="#CO137-1"><i class="conum" data-value="1"></i></a></p>
</td>
<td align="left" valign="top">
<p>numeric expression</p>
</td>
</tr>
</table>
</div>
<p><span class="strong strong"><strong>Output</strong></span>: double numeric value</p>
<p><span class="strong strong"><strong>Description</strong></span>: Convert from <a href="https://en.wikipedia.org/wiki/Radian" class="ulink" target="_top">radians</a>
to <a href="https://en.wikipedia.org/wiki/Degree_(angle)" class="ulink" target="_top">degrees</a>.</p>
<div class="pre_wrapper lang-sql">
<pre class="programlisting prettyprint lang-sql">SELECT DEGREES(PI() * 2), DEGREES(PI());

DEGREES(PI() * 2)| DEGREES(PI())
-----------------+---------------
360.0            |180.0</pre>
</div>
</div>

<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="sql-functions-math-radians"></a><code class="literal">RADIANS</code><a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/sql/functions/math.asciidoc">edit</a>
</h3>
</div></div></div>
<p><strong>Synopsis:</strong></p>
<div class="pre_wrapper lang-sql">
<pre class="programlisting prettyprint lang-sql">RADIANS(numeric_exp) <a id="CO138-1"></a><i class="conum" data-value="1"></i></pre>
</div>
<p><span class="strong strong"><strong>Input</strong></span>:</p>
<div class="calloutlist">
<table border="0" summary="Callout list">
<tr>
<td align="left" valign="top" width="5%">
<p><a href="#CO138-1"><i class="conum" data-value="1"></i></a></p>
</td>
<td align="left" valign="top">
<p>numeric expression</p>
</td>
</tr>
</table>
</div>
<p><span class="strong strong"><strong>Output</strong></span>: double numeric value</p>
<p><span class="strong strong"><strong>Description</strong></span>: Convert from <a href="https://en.wikipedia.org/wiki/Degree_(angle)" class="ulink" target="_top">degrees</a>
to <a href="https://en.wikipedia.org/wiki/Radian" class="ulink" target="_top">radians</a>.</p>
<div class="pre_wrapper lang-sql">
<pre class="programlisting prettyprint lang-sql">SELECT RADIANS(90), PI()/2;

   RADIANS(90)    |      PI()/2
------------------+------------------
1.5707963267948966|1.5707963267948966</pre>
</div>
</div>

<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="sql-functions-math-sin"></a><code class="literal">SIN</code><a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/sql/functions/math.asciidoc">edit</a>
</h3>
</div></div></div>
<p><strong>Synopsis:</strong></p>
<div class="pre_wrapper lang-sql">
<pre class="programlisting prettyprint lang-sql">SIN(numeric_exp) <a id="CO139-1"></a><i class="conum" data-value="1"></i></pre>
</div>
<p><span class="strong strong"><strong>Input</strong></span>:</p>
<div class="calloutlist">
<table border="0" summary="Callout list">
<tr>
<td align="left" valign="top" width="5%">
<p><a href="#CO139-1"><i class="conum" data-value="1"></i></a></p>
</td>
<td align="left" valign="top">
<p>numeric expression</p>
</td>
</tr>
</table>
</div>
<p><span class="strong strong"><strong>Output</strong></span>: double numeric value</p>
<p><span class="strong strong"><strong>Description</strong></span>: Returns the <a href="https://en.wikipedia.org/wiki/Trigonometric_functions#sine" class="ulink" target="_top">sine</a> of <code class="literal">numeric_exp</code>, where <code class="literal">numeric_exp</code> is an angle expressed in radians.</p>
<div class="pre_wrapper lang-sql">
<pre class="programlisting prettyprint lang-sql">SELECT SIN(RADIANS(90)), POWER(SIN(RADIANS(67)), 2) + POWER(COS(RADIANS(67)), 2) AS pythagorean_identity;

SIN(RADIANS(90))|pythagorean_identity
----------------+--------------------
1.0             |1.0</pre>
</div>
</div>

<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="sql-functions-math-sinh"></a><code class="literal">SINH</code><a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/sql/functions/math.asciidoc">edit</a>
</h3>
</div></div></div>
<p><strong>Synopsis:</strong></p>
<div class="pre_wrapper lang-sql">
<pre class="programlisting prettyprint lang-sql">SINH(numeric_exp) <a id="CO140-1"></a><i class="conum" data-value="1"></i></pre>
</div>
<p><span class="strong strong"><strong>Input</strong></span>:</p>
<div class="calloutlist">
<table border="0" summary="Callout list">
<tr>
<td align="left" valign="top" width="5%">
<p><a href="#CO140-1"><i class="conum" data-value="1"></i></a></p>
</td>
<td align="left" valign="top">
<p>numeric expression</p>
</td>
</tr>
</table>
</div>
<p><span class="strong strong"><strong>Output</strong></span>: double numeric value</p>
<p><span class="strong strong"><strong>Description</strong></span>: Returns the <a href="https://en.wikipedia.org/wiki/Hyperbolic_function" class="ulink" target="_top">hyperbolic sine</a> of <code class="literal">numeric_exp</code>.</p>
<div class="pre_wrapper lang-sql">
<pre class="programlisting prettyprint lang-sql">SELECT SINH(5), (POWER(E(), 5) - POWER(E(), -5)) / 2 AS "(e^5 - e^-5)/2";

     SINH(5)     | (e^5 - e^-5)/2
-----------------+-----------------
74.20321057778875|74.20321057778874</pre>
</div>
</div>

<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="sql-functions-math-tan"></a><code class="literal">TAN</code><a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/sql/functions/math.asciidoc">edit</a>
</h3>
</div></div></div>
<p><strong>Synopsis:</strong></p>
<div class="pre_wrapper lang-sql">
<pre class="programlisting prettyprint lang-sql">TAN(numeric_exp) <a id="CO141-1"></a><i class="conum" data-value="1"></i></pre>
</div>
<p><span class="strong strong"><strong>Input</strong></span>:</p>
<div class="calloutlist">
<table border="0" summary="Callout list">
<tr>
<td align="left" valign="top" width="5%">
<p><a href="#CO141-1"><i class="conum" data-value="1"></i></a></p>
</td>
<td align="left" valign="top">
<p>numeric expression</p>
</td>
</tr>
</table>
</div>
<p><span class="strong strong"><strong>Output</strong></span>: double numeric value</p>
<p><span class="strong strong"><strong>Description</strong></span>: Returns the <a href="https://en.wikipedia.org/wiki/Trigonometric_functions#tangent" class="ulink" target="_top">tangent</a> of <code class="literal">numeric_exp</code>, where <code class="literal">numeric_exp</code> is an angle expressed in radians.</p>
<div class="pre_wrapper lang-sql">
<pre class="programlisting prettyprint lang-sql">SELECT TAN(RADIANS(66)) AS "TAN(66)", SIN(RADIANS(66))/COS(RADIANS(66)) AS "SIN(66)/COS(66)=TAN(66)";

     TAN(66)      |SIN(66)/COS(66)=TAN(66)
------------------+-----------------------
2.2460367739042164|2.246036773904216</pre>
</div>
</div>

</div>
<div class="navfooter">
<span class="prev">
<a href="sql-functions-search.html">« Full-Text Search Functions</a>
</span>
<span class="next">
<a href="sql-functions-string.html">String Functions »</a>
</span>
</div>
</div>

                  <!-- end body -->
                        </div>
                        <div class="col-xs-12 col-sm-4 col-md-4" id="right_col">
                        
                        </div>
                    </div>
                </div>
            </section>
        </div>
    </section>
</div>
<script src="../static/cn.js"></script>
</body>
</html>